#include <stdio.h>
#include "DP100.h"
#include <Windows.h>

void printInfo(unsigned short V, unsigned short I)
{
    printf("V = %d, I = %d\n",V,I);
}

int main()
{
    char param1[50]={0}; char param2[50]={0}; char param3[50]={0}; char param4[50]={0}; char param5[50]={0};
    uint8_t index=3; uint8_t state=0; uint16_t vset=0; uint16_t iset=0; uint16_t ovp=0; uint16_t ocp=0;
    uint8_t blklev; uint8_t vollev; uint16_t opp; uint16_t otp; uint8_t en_rep; uint8_t en_auto_out;
    BasicInfoIndication_p = printInfo;

    printf("    DP100\n");
    if(!ConnState()) 
        DevOpenOrClose();
    printf("Connect State:%d\n",ConnState());


    // printf("%d,%d,%d,%d\n",vset,iset,ovp,ocp);
    // Sleep(10000);
    // GetBasicInfo(&vset,&iset);
    // printf("V = %d, I = %d\n",vset,iset);
    // CloseOut(0,5000,24000);
    // SetGroupInfo(1,3000,12000,5000,30000);
    // UseGroup(1);
    // CloseOut(1,5000,3000);
    // SetSysPar(4,4,1550,80,1,0);
    // printf("%s",param1);

    Sleep(5000);

    GetDevInfo(param1,param2,param3,param4,param5);
    printf("%s,%s,%s,%s,%s\n",param1,param2,param3,param4,param5);
    GetCurrentBasic(&index,&state,&vset,&iset,&ovp,&ocp);
    printf("%d,%d,%d,%d,%d,%d\n",index,state,vset,iset,ovp,ocp);
    GetGroupInfo(index,&iset,&vset,&ocp,&ovp);
    printf("%d,%d,%d,%d,%d,%d\n",index,state,vset,iset,ovp,ocp);
    GetSysPar(&blklev, &vollev, &opp, &otp, &en_rep, &en_auto_out);
    printf("%d,%d,%d,%d,%d,%d\n",blklev, vollev, opp, otp, en_rep, en_auto_out);
    GetCurrentBasic(&index,&state,&vset,&iset,&ovp,&ocp);
    printf("%d,%d,%d,%d,%d,%d\n",index,state,vset,iset,ovp,ocp);
    GetBasicInfo();
    
    Sleep(1000);

    return 1;
}